import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class 生成BCrypt密码 {
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String password = "123456";
        String encoded = encoder.encode(password);
        
        System.out.println("明文密码: " + password);
        System.out.println("加密后: " + encoded);
        System.out.println();
        System.out.println("验证测试:");
        System.out.println("matches: " + encoder.matches(password, encoded));
        
        // 测试SQL中的密码
        String sqlPassword = "$2a$10$7JINBWkPKVs3h0y4c.NRXeWMxVzjQX5vC5jP0qYnN8kIc3qGVqYh6";
        System.out.println();
        System.out.println("SQL中的密码验证:");
        System.out.println("matches: " + encoder.matches(password, sqlPassword));
    }
}

